package Medicine;

//药店 存放药材数组
public class Pharmacy {
    private Goods[] goods;
    private static final int DEFAULT_SIZE = 10;

    private int usedSize;//有效药品个数（药房里面有多少种东西）

    public Pharmacy(){
        this.goods = new Goods[DEFAULT_SIZE];
        //示例: 编号1 六味地黄丸 是中药 价格为50 剩余数量为10 生产日期为2023年5月1日 保质期为18个月
        this.goods[0] = new Medicine(1,"六味地黄丸","中药",50,10,"2023-5-1",18);
        this.goods[1] = new Medicine(2,"布洛芬","西药",30,10,"2023-9-1",24);
        this.goods[2] = new Equipment(3,"轮椅","医疗器械",54,9);
        this.goods[3] = new Equipment(3,"体温计","医疗器械",50,10);
        this.usedSize=4;
    }

    public int getUsedSize() {
        return usedSize;
    }

    public Goods[] getGoods() {
        return goods;
    }

    public void setUsedSize(int usedSize) {
        this.usedSize = usedSize;
    }

    public Goods getMedicines(int pos) {
        //查找时，依次返回药品数组中的元素
        if(pos<0){
            return null;
        }
        return goods[pos];
    }


    public void setMedicines(int pos ,Goods good){
        //退出系统时，将对象依次置为空
         goods[pos] = good;
    }

}
